package com.haiqi.modules.report.service;

import com.github.pagehelper.PageInfo;
import com.haiqi.common.bean.PageBean;
import com.haiqi.common.persistence.dao.VoyageReportMapper;
import com.haiqi.common.persistence.entity.VoyageReport;
import com.haiqi.common.utils.PageUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by hythzx on 2016/5/23.
 */

@Service
@EnableCaching
public class VoyageReportService {

    @Autowired
    private VoyageReportMapper voyageReportMapper;

//    @Cacheable(value = "reportcache", keyGenerator = "wiselyKeyGenerator")
    public PageInfo<VoyageReport> getList(VoyageReport voyageReport, PageBean page){
        System.out.println("通过service获取数据...");
        PageUtils.generatePage(page);
        List<VoyageReport> voyageReports = voyageReportMapper.getDataList(voyageReport);
        PageInfo pageInfo = new PageInfo(voyageReports);
        return pageInfo;
    }
}
